<?php
// Location: application/classes/database.class.php

class class_database {
  // Variables
  private $variables;
  
  // Functions
  function database($type, $server, $username, $password, $name) {
    $this->variables['type'] = $type;
    switch ($this->variables['type']) {
      case "mysql":
        $this->variables['connection'] = mysql_connect($server, $username, $password) or die('Class: database - Unable to connect to server');
        mysql_select_db($name, $this->variables['connection']) or die('Class: database - Unabled to connect to database');
      break;
      default:
        return false;
      break;
    }
  }
  function query($sql) {
    switch ($this->variables['type']) {
      case "mysql":
        $query = mysql_query($sql, $this->variables['connection']) or die('Class: database - Unable to perform query');
        return $query;
      break;
      default:
        return false;
      break;
    }
  }
}

?>
